package com.gistmap.sideline.exception;

import com.gistmap.sideline.model.ErrorItems;
import lombok.Getter;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@Getter
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
public class AppException extends RuntimeException {
    private int code;
    private String message;

    public AppException(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public AppException(String message){
        super(message);
    }

    public AppException(ErrorItems errorItems) {
        this.code = errorItems.getCode();
        this.message = errorItems.getMessage();
    }
}